//路由配置信息
export default [
  {
    path:"/login",
    component:()=>import('@/pages/Login'),
  },
  {
    path:"/register",
    component:()=>import('@/pages/Register'),
    //路由独享守卫
    beforeEnter:(to,from,next)=>{
      if(from.path=='/login'){
        //去注册页面，必须是从登录来
        next();
      }else{
        //不放行，回到from.path
        next(false);
      }
    }
  },
  {
    path:"/home",
    component:()=>import('@/pages/Home'),
    //二级路由注册
    children: [
      {
        //路由要么写全，要么直接写子路由名字
        path:"work",
        component:()=>import('@/pages/Home/work'),
      },
      {
        path:"order",
        component:()=>import('@/pages/Home/order'),
      },
      {
        path:"person",
        component:()=>import('@/pages/Home/person'),
      },
      //二级路由重定向，默认打开myorder
      {
        path:'/home',
        redirect:'/home/work'
      }
    ],
  },
  //重定向，项目运行时默认打开首页
  {
    path:'*',
    redirect:'/login'
  }
]